﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.MonthCalendar;

namespace sy2_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            // 1. 类型转换：TextBox的Text（字符串）转double（数值）
            double radius = Convert.ToDouble(textBox1.Text);
            // 2. 计算面积和周长（用Math.PI表示π）
            double area = Math.PI * radius * radius;
            double circumference = 2 * Math.PI * radius;
            // 3. 结果格式化：保留6位小数，转字符串显示到只读TextBox
            textBox2.Text = area.ToString("F6");
            textBox3.Text = circumference.ToString("F6");
        }
    
    }
}
